<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- Bootstrap CSS-->
    <link rel="stylesheet" href="${pageContext.request.contextPath}/assets/vendor/bootstrap/css/bootstrap.css">
    <!-- Font Awesome CSS-->
    <link rel="stylesheet"
          href="${pageContext.request.contextPath}/assets/vendor/font-awesome/css/font-awesome.min.css">
    <!-- Custom Font Icons CSS-->
    <link rel="stylesheet" href="${pageContext.request.contextPath}/assets/css/font.css">
    <!-- theme stylesheet-->
    <link rel="stylesheet" href="${pageContext.request.contextPath}/assets/css/style.default.css" id="theme-stylesheet">
    <!-- Custom stylesheet - for your changes-->
    <link rel="stylesheet" href="${pageContext.request.contextPath}/assets/css/custom.css">
    <title>文章详情</title>
    <style>
        .myList li {
            display: inline-block;
        }
    </style>
</head>
<body>
<%@include file="../publicjsp/head.jsp" %>

<div class="d-flex align-items-stretch">
    <!-- Sidebar Navigation-->
    <nav id="sidebar">
        <!-- Sidebar Header-->
        <%@include file="../publicjsp/sideHead.jsp" %>
        <!-- Sidebar Navidation Menus--><span class="heading">Main</span>
        <%@include file="../publicjsp/sidebar.jsp" %>

    </nav>
    <!-- Sidebar Navigation end-->
    <div class="page-content">
        <div class="page-header">
            <div class="container-fluid">
                <h2 class="h5 no-margin-bottom">文章详情</h2>
            </div>
        </div>

        <section class="no-padding-bottom">

            <div class="myTitle">
                <h3 class="text-center">${article.title}</h3>
                <c:if test="${iffavorite ==1}">
                    <input id="delfa" type="button" value="取消收藏" class="btn btn-info">
                </c:if>
                <c:if test="${iffavorite ==0}">
                    <input id="addfa" type="button" value="收藏" class="btn btn-info">
                </c:if>

            </div>

            <div class="myContent">
                <p class="h6"><strong>发布人：</strong>${article.title}</p>
                <p class="h6"><strong>创建时间：</strong>${article.publishDate}</p>
                <p class="h6"><strong>浏览次数：</strong>${article.browseCount}</p>
                <p class="h6"><strong>收藏次数：</strong>${num}</p>
                <textarea style="padding: 2px" disabled="disabled" class="form-control"
                          rows="11">${article.content}</textarea>
            </div>
            <c:if test="${userFavorite.size() > 0}">
                <div class="myList">
                    <p>您关注的小伙伴等人也收藏了该文章</p>
                    <ul>
                        <c:forEach items="${userFavorite}" var="user">
                            <li class="list-group-item">
                                <a href="#">${user.username}</a>
                            </li>
                        </c:forEach>
                    </ul>
                </div>
            </c:if>
        </section>

        <%@include file="../publicjsp/footer.jsp" %>
    </div>
</div>

<!-- JavaScript files-->
<script src="${pageContext.request.contextPath}/assets/vendor/jquery/jquery.min.js"></script>
<script src="${pageContext.request.contextPath}/assets/vendor/popper.js/umd/popper.min.js"></script>
<script src="${pageContext.request.contextPath}/assets/vendor/bootstrap/js/bootstrap.min.js"></script>
<script src="${pageContext.request.contextPath}/assets/vendor/jquery.cookie/jquery.cookie.js"></script>
<script src="${pageContext.request.contextPath}/assets/vendor/chart.js/Chart.min.js"></script>
<script src="${pageContext.request.contextPath}/assets/vendor/jquery-validation/jquery.validate.min.js"></script>
<script src="${pageContext.request.contextPath}/assets/js/charts-home.js"></script>
<script src="${pageContext.request.contextPath}/assets/js/front.js"></script>
<script src="${pageContext.request.contextPath}/assets/js/custom.js"></script>

<script>
    $(function () {
        $("#delfa").click(function () {
            window.location.href = '${pageContext.request.contextPath}/article/delfa?a_id=${article.id}'
        });
        $("#addfa").click(function () {
            window.location.href = '${pageContext.request.contextPath}/article/addfa?a_id=${article.id}'
        })

    })

</script>

</body>
</html>